﻿Imports System.Windows.Forms

Public Class FrmLonLat
    Private Sub FrmLonLat_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub TbTecentMapLink_DoubleClick(sender As Object, e As EventArgs) Handles TbTecentMapLink.DoubleClick
        Dim add As String = TbTecentMapLink.Text.Trim()
        Dim result = ParseAndConvertGcj02ToWgs84(add)
        If Not Double.IsNaN(result.longitude) AndAlso Not Double.IsNaN(result.latitude) Then
            Dim address As String = result.address
            Dim lon As String = result.longitude.ToString()
            Dim lat As String = result.latitude.ToString()
            TbLon.Text = lon
            TbLat.Text = lat
            TbOmapLonlat.Text = lon + "," + lat
            TbGoogleEartnLonlat.Text = $"<Placemark>
	<name>{address}</name>
	<open>1</open>
	<Point>
		<gx:drawOrder>1</gx:drawOrder>
		<coordinates>{lon},{lat},0</coordinates>
	</Point>
</Placemark>"
        Else
            MessageBox.Show("不可识别！", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
End Class